package com.jcj.jcjrpc.demo.provider;

import com.jcj.jcjrpc.core.annotation.JcjProvider;
import com.jcj.jcjrpc.core.api.RpcException;
import com.jcj.jcjrpc.demo.api.Order;
import com.jcj.jcjrpc.demo.api.OrderService;
import org.springframework.stereotype.Component;

@Component
@JcjProvider
public class OrderServiceImpl implements OrderService {
    @Override
    public Order findById(Integer id) {

        if(id == 404) {
            throw new RpcException("404 exception");
        }

        return new Order(id.longValue(), 15.6f);
    }
}
